package com.cango.student;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

public class Thed {
    public static void main(String[] args) {
//        ExecutorService executorService = Executors.newCachedThreadPool(r -> {
//            Thread thread = new Thread(r, "test");
//            thread.setDaemon(true);
//            return thread;
//        });
//
//        Runnable main = () -> {
//            try {
//                Runnable runnable = () -> {
//                    try {
//                        Thread.sleep(5000);
//                        System.out.println(Thread.currentThread().getName() + "runnable");
//                    } catch (Exception e) {
//
//                    }
//                };
//                executorService.execute(runnable);
//            } catch (Exception e) {
//
//            }
//        };
//
//        Thread t = new Thread(main);
////        t.setDaemon(true);
//        t.start();
//
//
//        int i = 0;
//        while(i == 0) {
//            try {
//                TimeUnit.SECONDS.sleep(1);
//                i++;
//            } catch (InterruptedException e) {
//                e.printStackTrace();
//            }
//        }
//
////        System.exit(1);
        String i = "xiejiefeng";
        System.out.println(Integer.toUnsignedString(14));
        System.out.println(Integer.toHexString(14)); // 16进制
        System.out.println(Integer.toBinaryString(14 )); // 二进制
//        System.out.println(Integer.toBinaryString(i >>> 16));
        System.out.println(Integer.toBinaryString(i.hashCode()));

        int initialCapacity = 256;
        System.out.println(tableSizeFor(initialCapacity + (initialCapacity >>> 1) + 1));

    }



    private static final int tableSizeFor(int c) {
        System.out.println(c);
        int n = c - 1;
        n |= n >>> 1;
        n |= n >>> 2;
        n |= n >>> 4;
        n |= n >>> 8;
        n |= n >>> 16;
        return n + 1;
    }
}
